home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
676-700
/
691
/
cmanual
/
ace2.lha
/
Intuition
/
Windows
/
Example3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-01
|
4KB
|
114 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) V3.0 Amiga C Club (ACC) */
/* ------------------------------- ------------------ */
/* */
/* Book: ACM Intuition Amiga C Club */
/* Chapter: Windows Tulevagen 22 */
/* File: Example3.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 92-05-01 */
/* Version: 1.10 */
/* */
/* Copyright 1992, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* This program will open a normal window which is connected to the */
/* Workbench Screen. The window will use all System Gadgets, and will */
/* automatically Activate the window. It will display it for 30 seconds, */
/* and then close it. (Remember that the Close Gadget does NOT close the */
/* window by itself, it will only inform you that the user wants to */
/* close it. But in this example we will not listen to what the user */
/* wants.) */
/* If your program is using Intuition you should include intuition.h: */
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
/* Declare a pointer to a Window structure: */
struct Window *my_window;
/* Declare and initialize your NewWindow structure: */
struct NewWindow my_new_window=
{
50, /* LeftEdge x position of the window. */
25, /* TopEdge y positio of the window. */
200, /* Width 200 pixels wide. */
100, /* Height 100 lines high. */
0, /* DetailPen Text should be drawn with colour reg. 0 */
1, /* BlockPen Blocks should be drawn with colour reg. 1 */
NULL, /* IDCMPFlags No IDCMP flags. */
SMART_REFRESH| /* Flags Intuition should refresh the window. */
WINDOWCLOSE| /* Close Gadget. */
WINDOWDRAG| /* Drag gadget. */
WINDOWDEPTH| /* Depth arrange Gadgets. */
WINDOWSIZING| /* Sizing Gadget. */
ACTIVATE, /* The window should be Active when opened. */
NULL, /* FirstGadget No Custom Gadgets. */
NULL, /* CheckMark Use Intuition's default CheckMark (v). */
"MY WINDOW", /* Title Title of the window. */
NULL, /* Screen Connected to the Workbench Screen. */
NULL, /* BitMap No Custom BitMap. */
80, /* MinWidth We will not allow the window to become */
30, /* MinHeight smaller than 80 x 30, and not bigger */
300, /* MaxWidth than 300 x 200. */
200, /* MaxHeight */
WBENCHSCREEN /* Type Connected to the Workbench Screen. */
};
main()
{
/* Open the Intuition Library: */
IntuitionBase = (struct IntuitionBase *)
OpenLibrary( "intuition.library", 0 );
if( IntuitionBase == NULL )
exit(); /* Could NOT open the Intuition Library! */
/* We will now try to open the window: */
my_window = (struct Window *) OpenWindow( &my_new_window );
/* Have we opened the window succesfully? */
if(my_window == NULL)
{
/* Could NOT open the Window! */
/* Close the Intuition Library since we have opened it: */
CloseLibrary( IntuitionBase );
exit();
}
/* We have opened the window, and everything seems to be OK. */
/* Wait for 30 seconds: */
Delay( 50 * 30);
/* We should always close the windows we have opened before we leave: */
CloseWindow( my_window );
/* Close the Intuition Library since we have opened it: */
CloseLibrary( IntuitionBase );
/* THE END */
}